<?php
require_once DOCUMENT_ROOT . DIR_SHARED_API . 'api_booking.php';

if (!empty($_SESSION['book_info']['status']) 
        && $_SESSION['book_info']['status'] === "started") {
    if (!empty($_SESSION['book_info']['booking_id'])) {
        api_booking::delete_booking($_SESSION['book_info']['booking_id']);
    }
}
if (!empty($_SESSION['book_info']['status']) 
        && $_SESSION['book_info']['status'] === "wait_skrill_payment") {
    if (api_booking::is_paid($_SESSION['book_info']['booking_id'])) {
        $skrill_payment = "paid";
    } else {
        api_booking::delete_booking($_SESSION['book_info']['booking_id']);
        $skrill_payment = "unpaid";
    }
}
unset($_SESSION['book_info']);